/*
 * BBApplication.java
 * classes : com.cc.bubbleanimation.application.BBApplication
 * @author Jun.w
 * V 1.0.0
 * Create at 2015年5月19日 上午10:07:33
 */
package com.cc.bubbleanimation.application;

import android.app.Application;
import android.util.DisplayMetrics;
import android.view.WindowManager;

/**
 * com.cc.bubbleanimation.application.BBApplication
 * 
 * @author Jun.w <br/>
 *         create at 2015年5月19日 上午10:07:33
 */
public class BBApplication extends Application {
  private static final String TAG = "BBApplication";

  private static BBApplication instance;

  public static BBApplication getInstance() {
    return instance;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    instance = this;
  }
  
  public int getScreenWidth() {
    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    return dm.widthPixels;
  }

  public int getScreenHeight() {
    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    return dm.heightPixels;
  }

  public int getDensityDpi() {
    WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    return dm.densityDpi;
  }
}
